package cn.xopencode.oss.convert.permission;

import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.oss.dal.mysql.dataobject.permission.PositionDO;
import cn.xopencode.oss.rpc.permission.dto.PositionPageDTO;
import cn.xopencode.oss.rpc.permission.dto.PositionUpdateDTO;
import cn.xopencode.oss.rpc.permission.dto.PositionCreateDTO;
import cn.xopencode.oss.rpc.permission.vo.PositionVO;
import cn.xopencode.oss.service.permission.bo.PositionBO;
import cn.xopencode.oss.service.permission.bo.PositionCreateBO;
import cn.xopencode.oss.service.permission.bo.PositionPageBO;
import cn.xopencode.oss.service.permission.bo.PositionUpdateBO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface PositionConvert {

    PositionConvert INSTANCE = Mappers.getMapper(PositionConvert.class);

    PositionDO convert(PositionCreateBO bean);

    PositionBO convert(PositionDO bean);

    PositionDO convert(PositionUpdateBO bean);

    PositionCreateBO convert(PositionCreateDTO bean);

    PositionUpdateBO convert(PositionUpdateDTO bean);

    PositionPageBO convert(PositionPageDTO bean);

    PositionVO convert(PositionBO bean);

    List<PositionBO> convertList(List<PositionDO> list);

    List<PositionVO> convertList02(List<PositionBO> list);

    @Mapping(source = "records", target = "list")
    PageResult<PositionBO> convertPage(IPage<PositionDO> page);

    PageResult<PositionVO> convertPage(PageResult<PositionBO> page);

}
